<?php
/*************************************************************************************
 *
 *	FileName: header_php.php
 *	Desc    : main outbox
 *	Author  : Seal
 *	Date    : 2010-1-2
 *
 *************************************************************************************/

	require_once 'lib/classes/Pager.php';
	
	$letters = null;
	$lettersCount = null;
	$page = null;
	
	$WebUI = GetWebUI();
	ProcessReceive( $letters, $lettersCount, $page, $WebUI );

	function ProcessReceive( &$letters, &$lettersCount, &$page, &$ui )
	{
		$letterDAO = GetLetterDAO();
		
		if( isset($_GET['p']) && is_numeric($_GET['p']) )
		{
			$curPage = $_GET['p'];
			$startPos = ( $_GET['p'] - 1 ) * MAIL_PER_PAGE;
		}
		else
		{
			$curPage = 1;
			$startPos = 0;
		}
			
		$letters = $letterDAO->GetOutLetters( GetLoginUserID(), $startPos );
		$lettersCount = $letterDAO->GetOutLetterCount( GetLoginUserID() );
		
		$currentURL = htmlspecialchars( $_SERVER["REQUEST_URI"] );
		
		if( $pos = strpos( $currentURL, '&' ) )
			$currentURL= substr( $currentURL, 0, $pos );
			
		$page = new Pager( $currentURL, $lettersCount, MAIL_PER_PAGE, $curPage, UP_RESULT_PAGE );
	
	}




?>
